
//
//  RangNotSupportView.m
//  FD
//
//  Created by xiaofang wang on 2018/11/7.
//  Copyright © 2018年 ZhiYuan Network. All rights reserved.
//

#import "RangNotSupportView.h"
@interface RangNotSupportView()
/**1.title*/
@property (nonatomic, strong) UILabel *titleLb;
/**2.detailLB*/
@property (nonatomic, strong) UILabel *detailLb;
/**3.确认*/
@property (nonatomic, strong) UIButton *sureBtn;

@end

@implementation RangNotSupportView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupView];
        self.backgroundColor = [UIColor whiteColor]; //白色
    }
    return self;
}

- (void)setupView {
    [self addSubview:self.titleLb];
    [self addSubview:self.detailLb];
    [self addSubview:self.sureBtn];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(10);
        make.top.equalTo(self.mas_top).offset(10);
        make.right.equalTo(self.mas_right).offset(-10);
        make.height.mas_equalTo(30);
    }];
    
    
    CGFloat kmargin = 10;
    
    [self.detailLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(kmargin);
        make.top.equalTo(self.titleLb.mas_bottom).offset(5);
        make.height.mas_equalTo(100);
        make.right.equalTo(self.mas_right).offset(-kmargin);
    }];
    
    [self.sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.detailLb.mas_bottom).offset(15);
        make.left.equalTo(self.mas_left).offset(kmargin);
        make.right.equalTo(self.mas_right).offset(-kmargin);
        make.height.mas_equalTo(40);
    }];
}
- (UILabel *)titleLb {
    if (!_titleLb) {
        _titleLb = [UILabel new];
        _titleLb.text = @"超出配送范围";
        _titleLb.textAlignment = NSTextAlignmentCenter;
        _titleLb.font = [UIFont systemFontOfSize:20 weight:18.0]; //字体加粗
    }
    return _titleLb;
}
- (UILabel *)detailLb {
    if (!_detailLb) {
        _detailLb = [UILabel new];
        _detailLb.text = @"抱歉,您的地址超出了我们的配送范围;若您确定使用改地址,您只能寻找到点自提或者选择预约门店到点用餐";
        _detailLb.textColor = [UIColor lightGrayColor];
        _detailLb.numberOfLines = 0;
    }
    return _detailLb;
}

- (UIButton *)sureBtn {
    if (!_sureBtn) {
        _sureBtn = [UIButton createFastRedBtnRadius:5 target:self action:@selector(clickSureAction:) title:@"确认"];
        [_sureBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
    }
    return _sureBtn;
}
- (void)clickSureAction:(UIButton *)btn
{
    if (self.clickSureBtnBlock) {
        self.clickSureBtnBlock();
    }
}






@end
